import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useloadingStore = defineStore(
  'loading',
  () => {
    // 全局加载状态
    const loading = ref(false)

    const showLoading = () => {
      loading.value = true
    }
    const hideLoading = () => {
      loading.value = false
    }
    return {
      loading,
      showLoading,
      hideLoading,
    }
  },
  {
    persist: true,
  },
)
